package com.mes.cloud.util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

/**
 * 全局常量定义.
 */
public interface Constants {
    interface MYSQLTY{
        String VARCHER = "varchar";
        String DATE = "date";
        String DATETIME = "datetime";
        String TIMESTAM = "timestamp";
        String INPUT = "input";
    }
    interface BME_BC_SUB{
        String SUB_SQL = "select `id`,`is_enable`,`status`,`name`,`type`,`ds`,`sub_name`,`bc_field`,`sub_field`,`pid`,`crtby`,`crtdate`,`updby`,`upddate` from `bme_bc_sub` where `pid` = ? ";
    }
    interface VALIDATEPARAM{
        /**
         * BC的条件验证
         */
        String VALIDA = "validation";
        /**
         * BC的sql的条件
         */
        String CONDITION = "condition";
        /**
         * BC的sql编码
         */
        String BC_WHERE_6 =" where ";
        /**
         * BC的sql编码
         */
        String BC_WHERE ="where";
        /**
         * BC的sql编码
         */
        String BC_WHERE_AND =" and ";
        /**
         * BC的sql编码
         */
        String BC_QUERYSQL ="bc_querysql";
        /**
         * bc的编码
        */
        String BCCODE = "bcCode";
        /**
         * 查询分页 起始页
         */
        String PAGEINDEX = "pageIndex";
        /**
         * 查询分页 分页长度
         */
        String PAGESIZE = "pageSize";
        /**
         * 查询分页 数字统计
         */
        String COUNTCODE = "countCode";


        /**
         * 查询分页 数字统计
         */
        String SEARCHFIELD = "searchField";

        /**
         * 查询分页 排序字段
         */
        String ORDERBYFIELD = "orderbyField";

        /**
         * pickmap里面的字段
         */
        String FIELD ="field";
        /**
         * pickmap里面的字段
         */
        String COLUNM ="colunm";
        /**
         * pickmap里面的唯一字段
         */
        String UQID ="id";
        /**
         * 过滤器参数
         */
        String INTERCEPT ="intercept";
        /**
         * 过滤器参数
         */
        String AOP ="aop";
        /**
         * 主表名称
         */
        String BCTTABLE = "bc_table";
        /**
         * 是否需要拦截
         */
        String BC_INTERCEPT ="bc_intercept";
    }
    interface REPORTPARAM{
        /**
         * 获取导出参数的数据sql
         */
        String GET_REPORT_SEL = "select `is_enable`,`status`,`name`,`type`,`ds`,`reportbc`,`reportnm`,`setfield`,`getfield`,`condition`,`reportfield`,`tmplatelurl`,`pid`,`crtby`,`crtdate`,`updby`,`upddate` where `id` = ?";
        String XSL = ".xls";
        String PDF = ".pdf";
    }
    /**
     * 全局ID
     */
        String ID ="id";
    interface FieldCustomType{
        /**
         * 实体类型
         */
        String CUSTOMTYPE_ENTITY = "Entity";
        /**
         * jion关联的技术类型
         */
        String CUSTOMTYPE_CALCULATION = "Calculation";
        /**
         * jion关联的技术类型
         */
        String CUSTOMTYPE_VIRTUAL = "Virtual";
    }
    /**
     * bme_bc_jion表对于的字段类型
     */
    interface Digital{
        /**
         * 获取DIGITAL的数据
         */
        String SELECT_BC_DIGITAL = "SELECT * FROM bme_bc_digital WHERE `bc_id`=? AND `code`=? ";

    }
    /**
     * bme_bc_pickMap表对于的字段类型
     */
    interface PickMap{
        /**
         * 获取DIGITAL的数据
         */
        String SELECT_BC_PICKMAP = "select `id`,`is_enable`,`status`,`name`,`type`,`ds`,`pickbc`,`pickname`,`setfield`,`getfield`,`condition`,`get_field_pk`,`get_field_show`,`pid`,`crtby`,`crtdate`,`updby`,`upddate`  from `bme_bc_pickmap` where `is_enable` =1 and `id` = ?";

    }
    /**
     * bme_bc_jion表对于的字段类型
     */
    interface JoinWay{
        String SELECT_BC_JOIN = "select is_enable,name,join_way,join_master_table,join_master_field,join_slave_table,join_slave_field,pid from bme_bc_join where is_enable = 1 and  name =? and pid=?";
        /**
         * jion关联的技术类型 Y表示进行left关联
         */
        String JOIN_WAY_Y = "Y";
        /**
         * jion关联的技术类型 N表示不进行left关联
         */
        String JOIN_WAY_N= "N";
    }
    /**
     * bme_bc_jion表对于的字段类型
     */
    interface BMEBC{
        /**
         * 查询bc的信息
         */
        String SELECT_BC_TABLE = "select id,is_enable,status,name,type,bc_table,bc_model,bc_filter,bc_memory,bc_intercept,bc_datasource,bc_querysql,pid from bme_bc where is_enable = 1 and code =?";
        /**
         * jion关联的技术类型 N表示不进行left关联
         */
        String SELECT_SYS= "select column_comment,column_name,character_maximum_length,data_type,extra,column_key FROM information_schema.columns where table_schema=? and table_name=? ";
    }
    /**
     * bme_bc_jion表对于的字段类型
     */
    interface BMEBC_FILED{
        /**
         * 查询bc_FILED的信息
         */
        String SELECT_BC_FILED_TABLE = "select id, is_enable,status,name,type,ds,is_list,is_update,is_add,is_detail,is_required,validation,extra,is_pk,field,colunm,field_custom_type,field_join,field_type,field_length,field_precision,field_default,field_pickbc,field_constraint,calculation,pid,crtby,crtdate,updby,upddate,sort,code_id,is_generate from bme_bc_filed where is_enable = 1 and  pid= ? ORDER BY sort,id DESC";
        String INSER_BC_FILED = "insert into bme_bc_filed ( id, NAME,type, ds,extra,is_pk, field, colunm, field_custom_type, field_type, field_length, pid, crtby, updby) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
        /**
         * jion关联的技术类型 N表示不进行left关联
         */
        String JOIN_WAY_N= "N";
    }

    interface BMEBC_PROCESS{
        /**
         * 查询bc_process的信息
         */
        String SELECT_BC_FILED_TABLE = "select id,type,code,name,jsonconfig,crtby,crtdate,updby,upddate,is_enable from " +
                "bme_bc_filed where is_enable = 1 and id = ? ORDER BY id DESC";

    }
    /**
     * 日期时间格式.
     */
    interface DateTimeFormat {
        /**
         * 缺省日期格式
         */
        String DATE_PATTERN = "yyyy-MM-dd";

        ThreadLocal<DateFormat> DATE_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat(DATE_PATTERN));

        /**
         * 缺省时间格式
         */
        String TIME_PATTERN = "HH:mm:ss";

        ThreadLocal<DateFormat> TIME_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat(TIME_PATTERN));

        /**
         * 缺省日期时间格式
         */
        String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss";

        ThreadLocal<DateFormat> DATE_TIME_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat(DATETIME_PATTERN));

    }
}
